package org.bronycorps.mlptss.domain.tweenable;

import org.bronycorps.mlptss.domain.actor.BulletActor;

import aurelienribon.tweenengine.TweenAccessor;

public class BulletAccessor implements TweenAccessor<BulletActor> {

	public static final int POSITION_X = 1;
	public static final int POSITION_XY = 2;

	@Override
	public int getValues(BulletActor target, int tweenType, float[] returnValues) {
		switch (tweenType) {
		case POSITION_X:
			returnValues[0] = target.getBullet().getModel().getPosition().x;
			return 1;
		case POSITION_XY:
			returnValues[0] = target.getBullet().getModel().getPosition().x;
			returnValues[1] = target.getBullet().getModel().getPosition().y;
			return 2;
		default:
			assert false;
			return -1;
		}
	}

	@Override
	public void setValues(BulletActor target, int tweenType, float[] newValues) {
		switch (tweenType) {
		case POSITION_X:
			target.getBullet().getModel().getPosition().x = (newValues[0]);
			break;
		case POSITION_XY:
			target.getBullet().getModel().getPosition()
					.set(newValues[0], newValues[1]);
			break;
		default:
			assert false;
			break;
		}
	}

}
